package com.rrym.basedata.controller;

import com.rrym.basedata.entity.TestPO;
import com.rrym.basedata.service.TestService;
import com.rrym.common.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author xiao lin gg 兄弟
 * @Description:
 * @Date 2020/8/15 8:31 下午
 */
@RestController
@RequestMapping("test")
public class TestController {

    @Autowired
    TestService testService;

    @RequestMapping("/test")
    public String testMethod(){
        int i=1/0;
        System.out.println("我被人搞错了");
        return "TestMethod -- 进来了";
    }

    @PostMapping
    public Result add(TestPO po){
        testService.addPO(po);
        return new Result();
    }

    @GetMapping
    public Result get(){

      List<Object> list =  testService.getPO();

        return new Result().put("list",list);
    }





}
